package com.useage.day05;

import java.util.Date;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.springframework.stereotype.Component;

// <bean id="timeCounter" class="com.useage.day05.TimeCounter" />
@Component
public class TimeCounter {

	public void time(ProceedingJoinPoint p) throws Throwable {
		//System.out.println("调用前");
		
		long start = new Date().getTime();
		
		p.proceed();

		long end = new Date().getTime();
		// System.out.println("调用后");
		
		
		Signature str = p.getSignature();
		
		System.out.println(str + ": 执行时间(毫秒)：" + (end-start));
	}
	
}
